package day06;

import day05.ArrDemo;

import javax.naming.ldap.ExtendedResponse;
import java.lang.Exception;
import java.util.Arrays;
import java.util.Random;

public class ArrDemo2 {
    public static void main(String[] args) {

        int[] arr=new int[10];
        for(int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
           // System.out.println(arr[i]);
        }
        int[] arr_b=new int[10];
        System.arraycopy(arr,5,arr_b,1,3);
      //  System.out.println(Arrays.toString(arr_b));
     //   Arrays.copyOf(,)

        Random ran=new Random();
       // double b=ran.nextInt(260)-100;
        for (int i=0;i<=10;i++){
          //  System.out.println(ran.nextInt(170)-10);
            int d= ArrDemo2.randMethod(-6,-250);
            System.out.println(d);
//            double b=ran.nextInt(47)*(-1)-53;
//            System.out.println(b);
        }
    }
    public static int randMethod(int star,int end) {
        if(star>end){
            System.out.println("输入有误,初始范围不能大于结束范围");
            return 0;
        }

        if (star < 0 && end>=0)
            return (int) ((Math.random() * (Math.abs(star) + end )) + star);
        else if(star >=0 && end >=0)
            return (int) ((Math.random() * (star + end)) - star);
        else if(star<0 && end <=0)
            return (int) ((Math.random() * (Math.abs(star) + end)) *-1+end);
        return 0;
        //  return 0.2f;
        //return 0;
    }

}
